<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Math </title>
    <script type="text/javascript">
        //向上取整
        document.write(Math.ceil(3.3) + "<br>");
        document.write(Math.ceil(-0.1) + "<br>");
        document.write(Math.ceil(-9.9) + "<br>");
        document.write(Math.ceil(8.9) + "<br>");
        //向下取整
        document.write(Math.floor(3.3) + "<br>");
        document.write(Math.floor(-0.1) + "<br>");
        document.write(Math.floor(-9.9) + "<br>");
        document.write(Math.floor(8.9) + "<br>");
        //四舍五入
        document.write(Math.round(3.3) + "<br>");
        document.write(Math.round(-0.1) + "<br>");
        document.write(Math.round(-9.9) + "<br>");
        document.write(Math.round(8.9) + "<br>");
        //使用random ()方法和round()，计算不大于10的整数。
        var random1 = (Math.random()) * 10;
        document.write(random1 + "<br>");
        document.write(Math.round(random1) + "<br>");
    </script>
</head>
<body>
</body>
</html>